package com.woniu.zsd.order.controller;


import com.woniu.waste.client.WasteClient;
import com.woniu.zsd.commons.core.model.Result;
import com.woniu.zsd.order.dto.StatisticsDto;
import com.woniu.zsd.order.service.IStatisticsService;
import com.woniu.zsd.user.entity.UserAddress;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-27
 */
@RestController
@RequestMapping("/statistics")
@Api(tags = "统计")
public class StatisticsController {

    @Autowired
    private WasteClient wasteClient;

    @Autowired
    private IStatisticsService statisticsService;

//    @GetMapping("/test")
//    public Result test(){
//        return wasteClient.getWasteTypeById(1);
//    }
    @GetMapping("/statistics")
    @ApiOperation("统计")
    public Result<List<StatisticsDto>> statistics(@ApiParam(value = "startDate",name = "开始时间") @RequestParam String startDate, @ApiParam(value = "endDate",name = "结束时间")@RequestParam String endDate, @RequestHeader String token){
          List<StatisticsDto> list =statisticsService.statistics(startDate,endDate);
          return new Result<List<StatisticsDto>>().setCode(200).setMsg("查询区间统计数据成功").setData(list);
    }
}
